/**   
* @ProjectName: ShopSytem
* @Title: DateUtil.java 
* @Package com.element5th.shop.comm 
* @Description: 常用的工具方法
* @author 第五元素小组   
* @date 2012-10-26 10:03:24 
* @version V1.0   
*/ 
package com.element5th.comm;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * The Class DateUtil.
 */
public final class DateUtil {
	public static String getDate(Date date) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String dateStr = df.format(date);
		return dateStr;
	}
	
	public static String getTime(Date date) {
		DateFormat df = new SimpleDateFormat("HH:mm:ss");
		String timeStr = df.format(date);
		return timeStr;
	}
	
	public static Date str2Date(String dateStr) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = null;
		try {
			date = df.parse(dateStr);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return date;
	}
}
